package group2assignone.ucm.manager;

import group2assignone.func.UCCtoALAdapter;
import group2assignone.model.Flight;
import group2assignone.ucm.UCController;
import group2assignone.view.manager.EditFlightView;

/**
 * use case to change ui to the edit flight view
 * @author group2
 */
public class UCUIEditFlight implements UCController {

    private EditFlightView editView = new EditFlightView();

    /**
     * initialises edit view
     * @param view
     */
    public UCUIEditFlight(EditFlightView view) {
        this.editView = view;
        editView.go();
    }

    @Override
    public void run() {
        Flight f = new Flight();
        //boolean exists = false;

        UCEditFlightSearch ucefs = new UCEditFlightSearch(editView, f);
        editView.setSearchAL(new UCCtoALAdapter(ucefs));

        UCEditFlight ucefe = new UCEditFlight(editView, f);
        editView.setEditAL(new UCCtoALAdapter(ucefe));

        UCEditFlightDone ucefd = new UCEditFlightDone(editView, f);
        editView.setDoneAL(new UCCtoALAdapter(ucefd));

        UCEditFlightCancel ucefc = new UCEditFlightCancel(editView);
        editView.setCancelAL(new UCCtoALAdapter(ucefc));

        UCEditFlightBack ucefb = new UCEditFlightBack(editView, f);
        editView.setBackAL(new UCCtoALAdapter(ucefb));

    }
}
